<template>
    <div>
        <div class="index-content">
            <div style="flex: 1 0 40%">
                <div class="content">
                    <charts :option="data.option" width="100%" height="800px" />
                </div>
            </div>
            <div style="flex:1 0 55%">
                <Suspense> <!-- 异步组件 -->
                    <template #default>
                        <chinaMap width="100%" height="800px" />
                    </template>
                </Suspense>
            </div>
        </div>
    </div>
</template>

<script setup>
import charts from './index.vue'
import chinaMap from './chinaMap.vue'
import { onMounted, ref, reactive, getCurrentInstance } from 'vue';
const main = ref(null)

const { proxy } = getCurrentInstance();

onMounted(async () => {
    // console.log(proxy.$api);
    // const res = await proxy.$api.mapApi.list({ a: 123 })
    // console.log(res);
})

const data = reactive({
    option: {
        title: {
            text: 'Basic Radar Chart'
        },
        legend: {
            data: ['Allocated Budget', 'Actual Spending']
        },
        radar: {
            // shape: 'circle',
            indicator: [
                { name: 'Sales', max: 6500 },
                { name: 'Administration', max: 16000 },
                { name: 'Information Technology', max: 30000 },
                { name: 'Customer Support', max: 38000 },
                { name: 'Development', max: 52000 },
                { name: 'Marketing', max: 25000 }
            ]
        },
        series: [
            {
                name: 'Budget vs spending',
                type: 'radar',
                data: [
                    {
                        value: [4200, 3000, 20000, 35000, 50000, 18000],
                        name: 'Allocated Budget'
                    },
                    {
                        value: [5000, 14000, 28000, 26000, 42000, 21000],
                        name: 'Actual Spending'
                    }
                ]
            }
        ]
    }
})
</script>

<style scoped>
.index-content {
    display: flex;
    justify-content: space-between;
}
</style>